﻿<controls:ChildWindow 
    x:Class="ibba.src.noriskbo.PageCadReserva"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:slc="clr-namespace:ibba.src.sl.componentes;assembly=ibba.src.sl.componentes"
    xmlns:slrv="clr-namespace:ibba.src.sl.recursos.Validations;assembly=ibba.src.sl.recursos"
    Width="Auto" Height="Auto" 
    FontSize="10.667" 
    Style="{StaticResource ChildWindowStyle}"
    Title="Cadastro de Reserva">
    
    <Grid x:Name="LayoutRoot" Margin="2">
        <toolkit:BusyIndicator x:Name="activity">
            <Grid Name="gridCampos">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                
                <slrv:ValidationManager x:Name="validatorManager" />

                <slc:ControlMenuBar x:Name="barraMenu" Grid.Row="1" VerticalAlignment="Bottom" BorderRadius="15,0,15,0" 
                                    Margin="0,10,0,0" VisibilityUserPanel="Collapsed" Background="{StaticResource BlueStrong}"/>

                <StackPanel Orientation="Vertical" Grid.Row="0">
                    <StackPanel Orientation="Horizontal" Margin="3">
                        <TextBlock Text="Cliente" Width="90" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                        <sdk:AutoCompleteBox x:Name="txtCliente" Width="400" ValueMemberPath="NomeCliente"
                                             SelectionChanged="txtCliente_SelectionChanged">
                            <sdk:AutoCompleteBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Vertical" MinWidth="{Binding Path=Width, ElementName=txtCliente}">
                                        <TextBlock Text="{Binding Path=NomeCliente}" />
                                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                                            <TextBlock Text="{Binding Path=CnpjCpf, Converter={StaticResource FormatCnpjCpfConverter}}" FontSize="9" Foreground="Blue" />
                                            <TextBlock Text=" | Id: " FontSize="9" Foreground="Black" Margin="5,0,0,0" />
                                            <TextBlock Text="{Binding Path=IdCliente}" FontSize="9" Foreground="Blue" Margin="5,0,20,0" />
                                        </StackPanel>
                                    </StackPanel>
                                </DataTemplate>
                            </sdk:AutoCompleteBox.ItemTemplate>
                        </sdk:AutoCompleteBox>
                    </StackPanel>

                    <StackPanel Orientation="Horizontal" Margin="3">
                        <TextBlock Text="SubLimite" Width="90" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                        <ComboBox Name="cboSublimite" Width="400" MinHeight="24" Height="Auto" 
                                  SelectedItem="{Binding Mode=TwoWay, Path=IdSubLimite}"
                                  SelectionChanged="cboSublimite_SelectionChanged">
                            <ComboBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="{Binding  Path=Descricao}" TextWrapping="Wrap" Width="{Binding ElementName=cboSublimite, Path=Width}" MinHeight="17" />
                                    </StackPanel>
                                </DataTemplate>
                            </ComboBox.ItemTemplate >
                        </ComboBox>
                    </StackPanel>

                    <StackPanel Orientation="Horizontal" Margin="3">
                        <TextBlock Text="Área Sublimite" Width="90" VerticalAlignment="Center" FontWeight="Bold" />
                        <ComboBox x:Name="cboAreaSubLimite" Height="22" Width="200" 
                                  VerticalAlignment="Center" HorizontalAlignment="Left"                                   
                                  SelectedItem="{Binding Path=IdSubAreaInslCred, Mode=TwoWay}"
                                  SelectionChanged="cboAreaSubLimite_SelectionChanged"
                                  Grid.ColumnSpan="2" Margin="0,2">
                            <ComboBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Vertical" MinWidth="150" Margin="0,1,10,1">
                                        <TextBlock>
                                            <Run Text="{Binding Path=DescricaoSubArea}"/>
                                            <Run Text=" (" FontSize="9" Foreground="{StaticResource ColorDetailCombo}"/>
                                            <Run Text="{Binding Path=DescricaoArea}" FontSize="9" Foreground="{StaticResource ColorDetailCombo}"/>
                                            <Run Text=" )" FontSize="9" Foreground="{StaticResource ColorDetailCombo}"/>
                                        </TextBlock>
                                        <StackPanel Orientation="Vertical" HorizontalAlignment="Right">
                                            <TextBlock FontSize="9" Foreground="{StaticResource ColorDetailCombo}" HorizontalAlignment="Right">
                                                <Run Text="Id: " Foreground="Black"/>
                                                <Run Text="{Binding Path=IdSubAreaInslCred}" />
                                            </TextBlock>
                                            <Border Style="{StaticResource LineBlue}" Width="150" Margin="0,2" HorizontalAlignment="Center"/>
                                        </StackPanel>
                                    </StackPanel>
                                </DataTemplate>
                            </ComboBox.ItemTemplate>
                        </ComboBox>
                    </StackPanel>
                    
                    <StackPanel Orientation="Horizontal" Margin="3">
                        <TextBlock Text="Vencimento" Width="90" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                        <sdk:DatePicker x:Name="dpDtVencimento" Width="130"
                                        CalendarClosed="dpDtVencimento_CalendarClosed"
                                        KeyUp="dpDtVencimento_KeyUp"
                                        LostFocus="dpDtVencimento_LostFocus"/>
                    </StackPanel>
                   
                    <StackPanel Orientation="Horizontal" Margin="3">
                        <TextBlock Text="Valor" Width="90" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Left"/>

                        <Border Background="#FFEBE8E8" HorizontalAlignment="Left" Padding="2" BorderBrush="Gray" BorderThickness="1">
                            <TextBlock Text="BRL:" FontSize="9" VerticalAlignment="Center" />
                        </Border>
                        <TextBox Name="txtValor" Width="173" MaxLength="18" Margin="-1,0,0,0"
                                 slrv:TextBoxFilterService.Filter="Decimal" 
                                 TextAlignment="Right" 
                                 TextChanged="txtValor_TextChanged"
                                 GotFocus="txtValor_GotFocus"
                                 LostFocus="txtValor_LostFocus"/>                        
                    </StackPanel>

                    <StackPanel Orientation="Horizontal" Margin="3">
                        <TextBlock Text="Motivo" Width="90" FontWeight="Bold" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                        <TextBox x:Name="txtObservacao" Width="400" Height="45" TextWrapping="Wrap" MaxLength="200"
                                 TextChanged="txtObservacao_TextChanged"/>
                    </StackPanel>
                </StackPanel>

            </Grid>

        </toolkit:BusyIndicator>
    </Grid>
</controls:ChildWindow>